'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const r = require('../../nodes/Scalar.cjs'),
  a = require('../../stringify/stringifyNumber.cjs'),
  o = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
    resolve: t =>
      t.slice(-3).toLowerCase() === 'nan'
        ? NaN
        : t[0] === '-'
          ? Number.NEGATIVE_INFINITY
          : Number.POSITIVE_INFINITY,
    stringify: a.stringifyNumber,
  },
  i = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    format: 'EXP',
    test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
    resolve: t => parseFloat(t),
    stringify(t) {
      const e = Number(t.value);
      return isFinite(e) ? e.toExponential() : a.stringifyNumber(t);
    },
  },
  f = {
    identify: t => typeof t == 'number',
    default: !0,
    tag: 'tag:yaml.org,2002:float',
    test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
    resolve(t) {
      const e = new r.Scalar(parseFloat(t)),
        n = t.indexOf('.');
      return (
        n !== -1 &&
          t[t.length - 1] === '0' &&
          (e.minFractionDigits = t.length - n - 1),
        e
      );
    },
    stringify: a.stringifyNumber,
  };
exports.float = f;
exports.floatExp = i;
exports.floatNaN = o;
